<?php

declare(strict_types=1);

namespace app\validate;

use think\Validate;

class User extends Validate
{
    protected $rule =   [
        'user_name'   => 'require|max:50',
        'dept_id' => 'require|number',
        'role_id' => 'require|number',
        'status' => 'require',
    ];

    protected $message  =   [
        'user_name.require' => '用户名称不能为空',
        'user_name.max' => '用户名称最多不能超过50个字符',
        'dept_id.require' => '请选择部门',
        'dept_id.number' => '部门选择有误',
        'role_id.require' => '请选择角色',
        'role_id.number' => '角色选择有误',
        'status.require' => '请选择用户状态', 
    ];

    protected $scene = [
        'add'  =>  ['user_name', 'dept_id', 'role_id', 'status'],
    ];
}
